package com.wzdigit.wms.basic.mapper.core.transfer;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzdigit.framework.orm.mybatis.MyBatisRepository;
import com.wzdigit.wms.basic.client.response.report.TransferGoodsExt;
import com.wzdigit.wms.basic.client.response.transfer.*;
import com.wzdigit.wms.basic.domain.transfer.TransferHeader;
import com.wzdigit.wms.basic.client.request.asn.SrarchTransferWareHouseRequest;
import com.wzdigit.wms.basic.client.request.transfer.SearchTransferManageRequest;
import com.wzdigit.wms.basic.client.request.transfer.SearchTransferTaskRequest;
import com.wzdigit.wms.basic.client.response.asnHeader.TransferWareHouseExt;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * <p>
 * 库存调拨单表头 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2021-01-19
 */
@MyBatisRepository
public interface TransferHeaderMapper extends BaseMapper<TransferHeader> {
	/**
	 * 获取所有的调拨任务-bs管理端
	 * @param search
	 * @return
	 */
	List<TransferManageResponse> getListTransferManage(
			@Param("dto") SearchTransferManageRequest dto,
			@Param("transferTypeList") List<String> transferTypeList,
			@Param("beginDate") Date beginDate,
			@Param("endDate") Date endDate);
	
	/**
	 * 获取所有的调拨任务-pda
	 * @param search
	 * @return
	 */
	List<TransferTaskResponse> getListTransferTask(
			@Param("dto") SearchTransferTaskRequest dto, 
			@Param("transferTypeList") List<String> transferTypeList,
			@Param("transferStatusList") List<Integer> transferStatusList);
			
	
	/**
	 * 获取所有的转仓单
	 * @param search
	 * @return
	 */
	List<TransferWareHouseExt> getListTable(SrarchTransferWareHouseRequest search);
	
	/**
	 * 获取所有的转仓单-pda
	 * @param search
	 * @return
	 */
	List<TransferHeaderPageResponse> getListPage(
			@Param("transferType")String transferType, @Param("status")Integer status, 
			@Param("transferNo")String transferNo, @Param("wareHouseIds")List<Integer> wareHouseIds);
	
	/**
	 * 根据transferNo和权限目标仓库=》查询
	 * @param search
	 * @return
	 */
	TransferHeaderResponse getOneByTransferNo(@Param("transferNo")String transferNo, 
			@Param("wareHouseIds")List<Integer> wareHouseIds);
	
	int updateStatusByTransferNoAndStatus(@Param("status") Integer status,
            @Param("transferNo") String transferNo, @Param("byOrStatus") Integer... byOrStatus);
	
	int updatePrintFlag(@Param("printFlag") Integer printFlag, @Param("modifyUser") String modifyUser, 
			@Param("transferHeaderIds") List<Integer> transferHeaderIds);

	/**
	 * 获取所有调拨单管理列表BS
	 * @param
	 * @return
	 */
	List<TransferRawResponse> getListTransferRaw(
			@Param("dto") SearchTransferTaskRequest dto,
			@Param("transferTypeList") List<String> transferTypeList,
			@Param("transferAllStatusList") List<Integer> transferAllStatusList,
			@Param("beginDate") Date beginDate,
			@Param("endDate") Date endDate);

	//查询调拨单下的SN
	List<TransferGoodsExt> selectSnExt(@Param("headerId")BigDecimal headerId);

	//更新调拨单关单时间
	int updateEndTime(@Param("headerId")Integer headerId);

}
